#include<iostream>
#include<fstream>
using namespace std;
#define MAXSIZE 100
#define ERROR 0
typedef struct //定义顺序表
{
	int *elem;
	int length;
}SqList;
int num_a = 0, num_b = 0;
void InitList_Sq(SqList &L, int n) //创建顺序表
{
	L.elem = new int[MAXSIZE];
	if (!L.elem)
		exit(0);
	L.length = 0;
}
void input(SqList &L, int n) //依次往顺序表L里输入数据
{
	int i = 0;
	while (n --) 
	{
		cin >> L.elem[i];
		i++;
	}
	L.length = i;
}
void output(SqList L) //依次输出顺序表里的每个元素
{
	int i;
	for (i = 0; i < L.length; i++) 
	{
		if (i)
			cout << ",";
		cout << L.elem[i];
	}
}
void MergeList_Sq(SqList LA, SqList LB, SqList &LC) //算法2.16 顺序有序表的合并
{
	//已知顺序有序表LA和LB的元素按值非递减排列
	//归并LA和LB得到新的顺序有序表LC，LC的元素也按值非递减排列
	/*****************************Begin**************************/
	LC.elem = new int[MAXSIZE];  
    LC.length = 0;               
    int i = 0, j = 0, k = 0;
    while (i < LA.length && j < LB.length) {
        if (LA.elem[i] <= LB.elem[j]) {
            LC.elem[k++] = LA.elem[i++];
        } else {
            LC.elem[k++] = LB.elem[j++];
        }
    }
    
    while (i < LA.length) LC.elem[k++] = LA.elem[i++];
    while (j < LB.length) LC.elem[k++] = LB.elem[j++];
    LC.length = k; 
    /*****************************End*****************************/
} //MergeList_List
int main() {
	SqList La, Lb, Lc;	
	scanf("%d", &num_a);
	scanf("%d", &num_b);

	InitList_Sq(La, num_a); //La表的创建
	input(La, num_a); //依次往顺序表La里输入数据
	InitList_Sq(Lb, num_b); //Lb表的创建	
	input(Lb, num_b); //依次往顺序表La里输入数据
	MergeList_Sq(La, Lb, Lc); //将顺序表La和Lb进行合并
	output(Lc);
	cout << endl;
	return 0;
}